home *** CD-ROM | disk | FTP | other *** search
- Path: news-m01.ny.us.ibm.net!usenet
- From: mitch@ibm.net
- Newsgroups: comp.lang.c++
- Subject: Re: C code in a C++ app
- Date: Wed, 06 Mar 1996 16:52:35 GMT
- Organization: NRMA
- Message-ID: <4hide6$33ng@news-s01.ny.us.ibm.net>
- References: <4h7t43$6as@frodo.smartlink.net>
- NNTP-Posting-Host: slip202-135-13-83.sy.au.ibm.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- thomash@warp10.smartlink.net (Thomas Hackbarth) wrote:
-
- >I'm working on porting a C app. from MAC to the PC. The app is basicly C
- >and I'm replacing the UI for the PC side. I need to compile and link C
- >code into my MFC application. I get errors basicly saying I can't compile
- >C code with CPP, OK I renamed the file to CPP then I need to add #include
- ><stdafx.h>. I would rather not change any of the C files at all. They
- >need to stay multiplatform as well as multi-compiler.
-
- >Does anyone know how to build a MCF app with C code, with out changing
- >the C code.
-
- >Thanks
- >Thomas
-
- You need to tell the compiler to use the linkage conventions of the
- "C" language using the extern declaration specifier. Eg
-
- extern "C" {
-
- // a whole bunch of C functions
- void foo(void)
- {
- .....
- }
-
- } // extern
-
- Mitch
-
-
- --
- Mitch Fielding
- mitch@ibm.net
-
-